<?php
include_once("Elegible.class.php");
include_once('Option.class.php');

class Radio extends Elegible
{
	var $input = "<input type=\"radio\" name=\"{name}\" value=\"{value}\" id=\"{id}\" {params}{checked} /><span{params}>{text}</span>\n";

	function Radio($id, $options = array())
	{
		parent::Elegible($id, $options);
	}
	function __getHTML()
	{
		$inputs = "";
		$search  = array('{name}', '{value}', '{id}', '{params}', '{checked}', '{text}');
		if (count($this->options) > 0)
		{
			foreach($this->options as $i => $option)
			{
				$replace = array($this->getName(), $option->ID, $this->ID.$i, $this->getParams(), $option->tilded ? ' checked' : '', $option->value);
				$inputs .= str_replace($search, $replace, $this->input);
			}
		}
		return $inputs;
	}
}

?>